﻿using System;
using AutoMapper;
using Pay.DTO;
using Pay.DTO.hfnative;
using Pay.DTO.hfpay;
using Pay.IService;
using Pay.Core;

namespace Pay.Service.AutoMapper {
	public class PayMapper : IStartupDto {
		private IMapperConfigurationExpression _cfg;
		public PayMapper(IMapperConfigurationExpression cfg) {
			_cfg = cfg;
		}
		public void Execute() {
			Create();
		}
		protected virtual void Create() {
			_cfg.CreateMap<quick_pay_model, hf_quick_pay>()
				.ForMember(dest => dest.tranAmt, src => src.MapFrom(c => c.tran_amount))
				.ForMember(dest => dest.sndCardType, src => src.MapFrom(c => c.card_type))
				.ForMember(dest => dest.protocolNo, src => src.MapFrom(c => c.protocol_no))
				.ForMember(dest => dest.payAcctName, src => src.MapFrom(c => c.account_name))
				.ForMember(dest => dest.payAcctNo, src => src.MapFrom(c => c.account_no))
				.ForMember(dest => dest.certNo, src => src.MapFrom(c => c.id_card))
				.ForMember(dest => dest.phones, src => src.MapFrom(c => c.mobile))
				.ForMember(dest => dest.cardExpire, src => src.MapFrom(c => c.vaild))
				.ForMember(dest => dest.cardCvn2, src => src.MapFrom(c => c.cvv2));
		}
	}
}